package com.topfinance.payment.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.topfinance.frame.dao.HibernateEntityDao;
import com.topfinance.frame.exception.AppException;
import com.topfinance.payment.ebo.TCfgProtocolEbo;
import com.topfinance.payment.service.ITCfgProtocolMgr;

/**
 * 该类自动实现了dao的一般方法，如add, remove, update
 * 在service中出现的大部分情况下是在向后台提交数据前的处理(如校验)及获取后台数据后的处理等
 * @author
 *
 */

public class TCfgProtocolMgrImpl extends HibernateEntityDao<TCfgProtocolEbo> implements ITCfgProtocolMgr {

	private static final Log log = LogFactory.getLog(TCfgProtocolMgrImpl.class);

	public List<TCfgProtocolEbo> getAllPrtcl() throws AppException{
		String hql = " from TCfgProtocolEbo t " ;
		String where = "";
		List<Object> paramList = new ArrayList<Object>();
		if (isNotBlank(where)) {
			where = " where " + where;
		}
		hql = hql + where;
		return find(hql,paramList.toArray());		
	}

	public TCfgProtocolEbo getProtocol(Integer oid) throws AppException {
		// TODO Auto-generated method stub
		return (TCfgProtocolEbo)get(oid);
	}

	public void addProtocol(TCfgProtocolEbo o) throws AppException {
		// TODO Auto-generated method stub
		save(o);
	}

	public void deleteProtocol(TCfgProtocolEbo o) throws AppException {
		// TODO Auto-generated method stub
		removeById(o.getClass(),o.getOid());
	}

	public void deleteProtocol(Integer o) throws AppException {
		// TODO Auto-generated method stub
		removeById(TCfgProtocolEbo.class,o);
	}

	public void editProtocol(TCfgProtocolEbo o) throws AppException {
		// TODO Auto-generated method stub
		saveOrUpdate(o);
	}
	
}
